package com.zd.commodity.userMng.biz.impl;

import java.sql.Timestamp;

import com.zd.commodity.biz.impl.BaseBiz;
import com.zd.commodity.userMng.biz.IUserBiz;
import com.zd.commodity.userMng.dao.IUserDao;
import com.zd.commodity.userMng.entity.User;

public class UserBiz extends BaseBiz<User> implements IUserBiz {
	private IUserDao userDao;
	
	@Override
	public User findByUsernameAndPwd(String username, String password) {
		return userDao.findByUsernameAndPwd(username, password);
	}
	
	public void setUserDao(IUserDao userDao) {
		this.userDao = userDao;
		this.setBaseDao(userDao);
	}
	

	public User findByUsername(String username){
		return userDao.findByUsername(username);
	}

	@Override
	public void updateLoginInfo(Timestamp longinDate, String loginIp,long id) {
		User user = userDao.get(id);
		user.setLogindate(longinDate);
		user.setLoginip(loginIp);
		userDao.update(user);
	}

}
